package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.AttendanceGroupInfo;
import com.group.project.hrms.mapper.AttendanceGroupInfoMapper;
import com.group.project.hrms.service.IAttendanceGroupInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class AttendanceGroupInfoService implements IAttendanceGroupInfoService {

    @Autowired
    private AttendanceGroupInfoMapper attendanceGroupInfoMapper;

    @Override
    public int insertAttendanceGroupInfo(AttendanceGroupInfo attendanceGroupInfo) {
        return attendanceGroupInfoMapper.insert(attendanceGroupInfo);
    }

    @Override
    public int deleteAttendanceGroupInfo(AttendanceGroupInfo attendanceGroupInfo) {
        return attendanceGroupInfoMapper.deleteByPrimaryKey(attendanceGroupInfo);
    }

    @Override
    public int updateAttendanceGroupInfo(AttendanceGroupInfo attendanceGroupInfo) {
        return attendanceGroupInfoMapper.updateByPrimaryKey(attendanceGroupInfo);
    }

    @Override
    public AttendanceGroupInfo selectOneAttendanceGroupInfo(AttendanceGroupInfo attendanceGroupInfo) {
        return null;
    }

    @Override
    public AttendanceGroupInfo selectOneAttendanceGroupInfoByAgId(String agid) {
        Example example = new Example(AttendanceGroupInfo.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("attendanceGroupId" , agid);
        return attendanceGroupInfoMapper.selectOneByExample(example);
    }

    @Override
    public List<AttendanceGroupInfo> selectAllAttendanceGroupInfo() {
        return attendanceGroupInfoMapper.selectAll();
    }
}
